package com.imay.live.model;

import android.os.Parcel;
import android.os.Parcelable;

import com.chad.library.adapter.base.entity.MultiItemEntity;
import com.imay.live.fragment.dynamics.DynamicsParams;

/**
 * Created by liangzhenxiong on 2017/04/08 0008.
 */

public class RoomInfoModel implements Parcelable, MultiItemEntity {
    //    user	{userInfoIcon}	主播信息
//    title	string	标题
//    imgFace	string	主播封面图片
//    url	string	拉流地址
//    city	string	城市
//    latitude	int	维度
//    longitude	int	经度
//    countUser	int	观众数
//    timeStart	int	开播时间 utc秒
    UserModel user;
    String title;
    String imgFace;
    String url;
    String city;
    int latitude;
    int longitude;
    int countUser;
    int timeStart;
    int openLiveType;
    int horizontal;


    public RoomInfoModel() {
    }


    protected RoomInfoModel(Parcel in) {
        user = in.readParcelable(UserModel.class.getClassLoader());
        title = in.readString();
        imgFace = in.readString();
        url = in.readString();
        city = in.readString();
        latitude = in.readInt();
        longitude = in.readInt();
        countUser = in.readInt();
        timeStart = in.readInt();
        openLiveType = in.readInt();
        horizontal = in.readInt();
    }

    public static final Creator<RoomInfoModel> CREATOR = new Creator<RoomInfoModel>() {
        @Override
        public RoomInfoModel createFromParcel(Parcel in) {
            return new RoomInfoModel(in);
        }

        @Override
        public RoomInfoModel[] newArray(int size) {
            return new RoomInfoModel[size];
        }
    };

    public UserModel getUser() {
        return user;
    }

    public void setUser(UserModel user) {
        this.user = user;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getImgFace() {
        return imgFace;
    }

    public void setImgFace(String imgFace) {
        this.imgFace = imgFace;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public int getLatitude() {
        return latitude;
    }

    public void setLatitude(int latitude) {
        this.latitude = latitude;
    }

    public int getLongitude() {
        return longitude;
    }

    public void setLongitude(int longitude) {
        this.longitude = longitude;
    }

    public int getCountUser() {
        return countUser;
    }

    public void setCountUser(int countUser) {
        this.countUser = countUser;
    }

    public int getTimeStart() {
        return timeStart;
    }

    public void setTimeStart(int timeStart) {
        this.timeStart = timeStart;
    }

    public int getOpenLiveType() {
        return openLiveType;
    }

    public void setOpenLiveType(int openLiveType) {
        this.openLiveType = openLiveType;
    }

    public int getHorizontal() {
        return horizontal;
    }

    public void setHorizontal(int horizontal) {
        this.horizontal = horizontal;
    }

    @Override
    public int getItemType() {
        return DynamicsParams.VIEWTYPE_LINEAR_LIVE;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeParcelable(user, flags);
        dest.writeString(title);
        dest.writeString(imgFace);
        dest.writeString(url);
        dest.writeString(city);
        dest.writeInt(latitude);
        dest.writeInt(longitude);
        dest.writeInt(countUser);
        dest.writeInt(timeStart);
        dest.writeInt(openLiveType);
        dest.writeInt(horizontal);
    }
    //是否游戏直播
    public boolean isGameLive(){
        return openLiveType==1;
    }
    //是否横屏
    public boolean isHorizontal(){
        return horizontal==1;
    }
}
